Skip to content

feat: initial scaffolding for the google-cloud-spanner-dbapi-driver package#16121

Open
bhatt4982 wants to merge 1 commit intomainfrom
dbapi-driver
Open

feat: initial scaffolding for the google-cloud-spanner-dbapi-driver package#16121
bhatt4982 wants to merge 1 commit intomainfrom
dbapi-driver

Conversation

@bhatt4982
Copy link
Contributor

initial scaffolding for the google-cloud-spanner-dbapi-driver package, including core files, tests, documentation, and build configurations.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #16120 🦕

… package, including core files, tests, documentation, and build configurations.
@bhatt4982 bhatt4982 requested review from a team as code owners March 18, 2026 08:27
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational structure for a new Python DBAPI 2.0 compliant driver for Google Cloud Spanner. It introduces the necessary directory layout, core module files, and initial configurations for development, testing, and documentation. The changes prepare the repository for the implementation of the actual Spanner DBAPI driver logic.

Highlights

  • New Package Scaffolding: An initial scaffolding for the google-cloud-spanner-dbapi-driver package has been created, laying the groundwork for a new Python DBAPI 2.0 compliant driver for Google Cloud Spanner.
  • Core Files and Structure: Essential files for the package's structure, including __init__.py, dbapi.py (defining DBAPI 2.0 globals), and version.py, have been added to establish the basic module layout.
  • Build and Linting Configuration: Comprehensive build and linting configurations have been set up, including .coveragerc for code coverage, .flake8 for style checks, mypy.ini for type checking, and noxfile.py for automation of development tasks like testing and documentation generation.
  • Documentation and Metadata: Initial documentation files (README.rst, docs/README.rst, docs/conf.py, docs/index.rst, docs/_static/custom.css, docs/_templates/layout.html) and repository metadata (.repo-metadata.json) have been added to support project information and future documentation efforts.
  • Testing Infrastructure: Placeholder unit and system test files (tests/unit/test_placeholder.py, tests/system/test_placeholder.py) along with their respective __init__.py files and Python version-specific constraint files (testing/constraints-*.txt) have been included to prepare for future test development.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request sets up the initial scaffolding for the google-cloud-spanner-dbapi-driver package. The changes are mostly boilerplate and configuration files. My review focuses on ensuring consistency and correctness across these new files. I've pointed out a few inconsistencies in release status indicators across README.rst, setup.py, and .repo-metadata.json. I've also suggested improvements to the documentation build configuration in docs/conf.py to make it more robust, and a change in noxfile.py to prevent the coverage check from failing with placeholder tests. Overall, this is a good starting point for the new package.

Comment on lines +94 to +96
release = __version__
# The short X.Y version.
version = ".".join(release.split(".")[0:2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current method of setting release and version is based on a hardcoded empty __version__ string on line 42, which is fragile. A better approach is to import the version directly from the package. This ensures the documentation always reflects the correct version. Please also remove the __version__ = "" on line 42.

Suggested change
release = __version__
# The short X.Y version.
version = ".".join(release.split(".")[0:2])
import google.cloud.spanner_driver.version
release = google.cloud.spanner_driver.version.__version__
# The short X.Y version.
version = ".".join(release.split(".")[0:2])

Comment on lines +6 to +7
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The release_level in .repo-metadata.json is set to preview, but this badge indicates a stable release. To maintain consistency, this should be updated to a preview badge.

Suggested change
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
.. |stable| image:: https://img.shields.io/badge/support-preview-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels

Comment on lines +6 to +7
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The release_level in .repo-metadata.json is set to preview, but this badge indicates a stable release. To maintain consistency, this should be updated to a preview badge.

Suggested change
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
.. |stable| image:: https://img.shields.io/badge/support-preview-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels

root_doc = "index"

# General information about the project.
project = "google-cloud-spanner-dbapi"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the package's distribution name, the project variable should be updated to google-cloud-spanner-dbapi-driver.

Suggested change
project = "google-cloud-spanner-dbapi"
project = "google-cloud-spanner-dbapi-driver"

test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=100")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

With the current placeholder tests, code coverage is 0%. The cover session will therefore fail due to --fail-under=100. It's better to set this to 0 for the initial scaffolding and add a TODO to increase it as tests are added.

Suggested change
session.run("coverage", "report", "--show-missing", "--fail-under=100")
session.run("coverage", "report", "--show-missing", "--fail-under=0") # TODO: Increase this as tests are added.

assert len(version_candidates) == 1
version = version_candidates[0]

release_status = "Development Status :: 1 - Planning"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The release status "Development Status :: 1 - Planning" is inconsistent with the release_level: "preview" in .repo-metadata.json. For a "preview" release, "Development Status :: 3 - Alpha" would be more appropriate.

Suggested change
release_status = "Development Status :: 1 - Planning"
release_status = "Development Status :: 3 - Alpha"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Spanner DBAPI project

1 participant